#ifndef CLOTH_H
#define CLOTH_H

#include "Primitive.h"
#include "Integrator.h"

#define FIXEDA	120
#define FIXEDB	110

class Cloth
{
public:
	Cloth(void);
	~Cloth(void);

	void InitCloth(char* filename);
	void UpdateCloth(float dt);
	void UpdateForce();
	void UpdateStiffness();
	void TimeIntegration();
	void ForwardEuler();
	void BackwardEuler();
	void ConstrainFixedPoint();
	void ApplyExternalForce();
	void ApplyStretchShearForce();
	void ApplyBendForce();
	void ResetStiffness();
	void AssemblyStiffness();
	void AssemblyCoefficient();


	mat3f OuterProduct(mat3f a, mat3f b);
	mat3f OuterProduct(vec3f a, vec3f b);

	VertexList		vertices;
	EdgeList		edges;
	TriangleList	triangles;

	Integrator		solver;

	float timestep;
	float k_stretch;
	float k_shear;
	float d_stretch;
	float d_shear;
	float bu, bv;

	vec3f fixed_A;
	vec3f fixed_B;
};

#endif

